#include "ALPMSER.h"

CALPMSER::CALPMSER()
{
}

CALPMSER::CALPMSER(CALStepItem* pStepItem)
{
	m_pStepItem = pStepItem;
}


CALPMSER::~CALPMSER()
{
}


void CALPMSER::test()
{

}
void CALPMSER::convert()
{
	if (m_pStepItem == NULL) return;

	try
	{
		CALSIPMSER* pStepItem = (CALSIPMSER*)m_pStepItem;

		if (pStepItem != NULL)
		{
			int _delta = pStepItem->GetItemDelta();
			int _min_area = pStepItem->GetItemMinArea();
			int _max_area = pStepItem->GetItemMaxArea();
			double _max_variation = pStepItem->GetItemMaxVariation();
			double _min_diversity = pStepItem->GetItemMinDiversity();
			int _max_evolution = pStepItem->GetItemMaxEvolution();
			double _area_threshold = pStepItem->GetItemAreaThreshold();
			double _min_margin = pStepItem->GetItemMinMargin();
			int _edge_blur_size = pStepItem->GetItemEdgeBlurSize();
			//int _delta = 5;
			//int _min_area = 60;
			//int _max_area = 14400;
			//double _max_variation = 0.25;
			//double _min_diversity = .2;
			//int _max_evolution = 200;
			//double _area_threshold = 1.01;
			//double _min_margin = 0.003;
			//int _edge_blur_size = 5;

			std::vector<KeyPoint> keyPoints;
			Ptr<MSER> fast = MSER::create(_delta, _min_area, _max_area, _max_variation, _min_diversity,
										_max_evolution, _area_threshold, _min_margin, _edge_blur_size);
			fast->detect(m_srcMat, keyPoints);

			drawKeypoints(m_srcMat, keyPoints, m_dstMat, Scalar::all(255), DrawMatchesFlags::DEFAULT);

			SetDstType(AL_DST_Mat_One);
		}
	
	}
	catch (...)
	{

	}
}

void CALPMSER::convert(const Mat &src, Mat &dst)
{

}